<{extend name="base" /}>
    <{block name="body" }>
        <style>html{font-size: 100px}</style>
        <div class="layui-body ">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class=""><a href="<{:url('admin/baidu/index')}>">已添加列表</a></li>
                    <li class=""><a href="<{:url('admin/baidu/create',['style_id'=>1])}>">样式一</a></li>
                    <li class="layui-this"><a href="<{:url('admin/baidu/create',['style_id'=>2])}>">样式二</a></li>
                    <li class=""><a href="<{:url('admin/baidu/create',['style_id'=>3])}>">样式三</a></li>
                    <li class=""><a href="<{:url('admin/baidu/create',['style_id'=>4])}>">样式四</a></li>
                    <li class=""><a href="<{:url('admin/baidu/create',['style_id'=>5])}>">样式五</a></li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show" id="app">
                        <div class="left">
                            <form class="layui-form" method="post" action="<{:url('admin/baidu/save')}>">
                                <input type="hidden" name="style" value="2">
                                <{php}>
                                if(request()->action() == 'edit'){
                                    echo '<input type="hidden" name="type" value="edit">';
                                    echo '<input type="hidden" name="id" value="'.request()->get('id').'">';
                                }
                                <{/php}>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="content[title]" id="title" lay-verify="required" v-model='title' placeholder="{用此符号可飘红，支持多个} 必须成对书写"
                                            class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">电话</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="content[tel]" v-model='tel' lay-verify="required" placeholder="例如：010-8888888" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="right" id="baidu-search">
                            <link rel="stylesheet" href="/baidu/css/style.css" />
                            <div class="result c-result c-clk-recommend">
                                <div class="c-container">
                                    <a href="" class="c-blocka">
                                        <h3 class="c-title c-gap-top-small" v-html="Ctitle"></h3>
                                    </a>
                                    <div class="wa-sg-kefu-content c-gap-bottom">
                                        <div class="c-row c-gap-top c-line-bottom">
                                            <div class="c-span2 c-gap-bottom-large">
                                                <div class="wa-sg-kefu-wt">
                                                    <img style="width:110%" src=""
                                                        alt="">
                                                </div>
                                            </div>
                                            <div class="c-span10 c-gap-bottom-large wa-sg-kefu-vertical-center">
                                                <p class="c-color-link wa-sg-kefu-ti">官方客服提示</p>
                                                <p class="c-color-gray wa-sg-kefu-p1">以下电话经百度手机卫士安全认证</p>
                                            </div>
                                        </div>
                                        <div class="c-row c-gap-top c-line-bottom">
                                            <div class="c-span12 c-gap-bottom">
                                                <a :href="Ctel" class="c-blocka WA_LOG_BTN wa-sg-kefu-btn">
                                                    <p class="c-color-link c-line-clamp1">统一客服电话</p>
                                                    <p class="c-color-gray" v-html="tel"></p>
                                                    <img class="wa-sg-kefu-call" src=""
                                                        alt="">
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="c-row c-gray">
                                        <div class="c-span6">
                                            <div class="c-line-clamp1  c-color-gray">
                                                <span class="c-foot-source">百度手机卫士</span>
                                            </div>
                                        </div>
                                        <div class="c-span6">
                                            <a :href="Ctel" class=" c-blocka c-moreinfo">
                                                <span>更多电话</span>
                                                <i class="c-icon c-gap-left-small">></i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
<{/block}>
<{block name="script" }>
                <style type="text/css">
                    .left,
                    .right {
                        float: left;
                    }

                    .left {
                        width: 60%;
                    }

                    .right {
                        height: 550px;
                        margin-left: 60px;
                        width: 300px;
                        border: 2px solid #ccc;
                        border-radius: 20px;
                        padding: 20px;
                        background: #f1f1f1;
                        box-shadow: 1px 2px #eeeeee5c;
                    }
                </style>
                <script src="/static/js/vue.js"></script>
                <script type="text/javascript">
                    var vue = new Vue({
                        el: "#app",
                        data: {
                            title: '',
                            tel: '010-8888888'
                        },
                        computed: {
                            Ctitle: function () {
                                if (this.title == '') {
                                    return '中国<em>移动</em>客服<em>电话</em>';
                                }
                                return this.title.replace(/{/g, '<em>').replace(/}/g, '</em>');
                            },
                            Ctel: function () {
                                return 'tel:' + this.tel;
                            }
                        },                        
                    });

                    <{php}>
                        if(request()->action() == 'edit'){

                            echo "vue.title = '".$data['content']['title']."';";
                            echo "vue.tel = '".$data['content']['tel']."';";
                            
                        }
                    <{/php}>

                </script>
                <{/block}>